<div class="modal-header">添加链接 <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button></div>
<div class="modal-body form-horizontal tab-content">
<div ng-show="modaldata.op=='add_url'" style="margin-top:15px">
	<div ng-if="!modaldata.item.isapp" class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 right-label">链接文字</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control  ng-pristine ng-valid ng-empty ng-touched" ng-model="modaldata.add_url.text" style="border-color: rgb(221, 221, 221);">
			<div class="help-block"></div>
		</div>
	</div>
	<div ng-if="!modaldata.item.isapp" class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 right-label">链接地址</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control  ng-pristine ng-valid ng-empty ng-touched" ng-model="modaldata.add_url.url" style="border-color: rgb(221, 221, 221);">
			<div class="help-block">必须是以http或https为前缀的完整地址！</div>
		</div>
	</div>
	<div ng-if="modaldata.item.isapp" class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 right-label">小程序名称</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control  ng-pristine ng-valid ng-empty ng-touched" ng-model="modaldata.add_url.text" style="border-color: rgb(221, 221, 221);">
			<div class="help-block"></div>
		</div>
	</div>
	<div ng-if="modaldata.item.isapp" class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 right-label">小程序appid</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control  ng-pristine ng-valid ng-empty ng-touched" ng-model="modaldata.add_url.appid" style="border-color: rgb(221, 221, 221);">
			<div class="help-block"></div>
		</div>
	</div>
	<div ng-if="modaldata.item.isapp" class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 right-label">小程序path</label>
		<div class="col-xs-12 col-sm-8 col-lg-9">
			<input type="text" class="form-control  ng-pristine ng-valid ng-empty ng-touched" ng-model="modaldata.add_url.path" style="border-color: rgb(221, 221, 221);">
			<div class="help-block">小程序首页的路径，示例：pages/index/index</div>
		</div>
	</div>
</div>
<div class="modal-footer" ng-if="modaldata.op=='add_url'"><a href="javascript:;" class="btn btn-primary" ng-click="modaldata.set_add_url(modaldata.add_url)">确定</a></div>
<script>
scope.modaldata.add_url={};
scope.modaldata.set_add_url=function(add_url){
	if(scope.modaldata.item.isapp){
		if(!add_url.text){
			scope.message('请输入小程序名称');
			return false;
		}
		if(!add_url.appid){
			scope.message('请输入小程序appid');
			return false;
		}
		if(!add_url.path){
			scope.message('请输入小程序path');
			return false;
		}
		var resultdata='<a href="javascript:void 0" data-miniprogram-appid="'+add_url.appid+'" data-miniprogram-path="'+add_url.path+'" data-miniprogram-nickname="'+add_url.text+'" data-miniprogram-type="text" data-miniprogram-servicetype="0">'+add_url.text+'</a>';
	}else{
		if(!add_url.text){
			scope.message('请输入链接文字');
			return false;
		}
		if(!add_url.url){
			scope.message('请输入链接地址');
			return false;
		}
		var resultdata='<a href="'+add_url.url+'">'+add_url.text+'</a>';
	}
	scope.modal_result(resultdata,'',true);
}
</script>